package day03;

import java.util.Arrays;

/**
 * Arrays 数组工具类
 * @author: yyfei  
 * @email:  yyfei123@qq.com
 */
public class ArraysGongJuLei {
	public static void main(String[] args) {
		int[] a0=new int[] {1,2,3};
		int[] a1=new int[] {1,2,3};
		int[] a2=new int[] {3,2,1};
		
		/**
		 * 判断两个数组是否相等
		 * 注意：相同的数组，顺序也应该一致
		 */
		
		boolean isEquals= Arrays.equals(a0, a1);
		System.out.println(isEquals);
		
		/**
		 * Arrays.toString()
		 */
		
		System.out.println(Arrays.toString(a1));
		
		
		/**
		 * Arrays.fill()
		 * 替换，将数组元素替换成指定的元素
		 */
		
		//Arrays.fill(a1, 6);//
		System.out.println(Arrays.toString(a1));
		
		/**
		 * Arrays.sort() 
		 * 升序排序
		 */
		Arrays.sort(a2);
		System.out.println(Arrays.toString(a2));
		
		/**
		 * 查找某个元素的位置(采用二分法)
		 */
		System.out.println(Arrays.binarySearch(a2, 2));
		
	}
}
